#include<stdio.h>
#define SIZE 20

typedef struct linear_stack
{
    int a[SIZE];
    int top;
}Stack;

// 初始化栈
void init(Stack *stack){
    stack->top=-1;
}

// 入栈
int push(Stack *stack, int data){
    int top;
    if(stack->top==SIZE-1){
        printf("栈已满...\n");
        return SIZE;
    }
    else{
        stack->a[++(stack->top)] = data;
        return stack->top;
    }
}

// 出栈
int pop(Stack *stack){
    int del;
    if(stack->top==-1){
        printf("栈已空，里面没有元素...\n");
        return -1;
    }
    else{
        del=stack->a[stack->top];
        return del;
    }
}


int main() {
    Stack stack;
    int top;
    init(&stack);
    top = push(&stack, 5);
    printf("入栈：%d", top);
}
